package com.ag.bean;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * TbDept entity.
 * 
 * @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "TB_DEPT", schema = "dbo", catalog = "AGDB")
public class TbDept implements java.io.Serializable {

	// Fields

	private String DId;
	private TbDept tbDept;
	private String DName;
	private String DLogoUrl;
	private String DAddress;
	private String DLati;
	private String DLng;
	private Integer DIf;
	private String a;
	private String b;
	private String c;
	private String GId;
	private String GDesc;
	private String GCode;
	private String GAdmin;
	private Set<TbDept> tbDepts = new HashSet<TbDept>(0);
	private Set<TbContact> tbContacts = new HashSet<TbContact>(0);

	// Constructors

	/** default constructor */
	public TbDept() {
	}

	/** minimal constructor */
	public TbDept(String DId) {
		this.DId = DId;
	}

	/** full constructor */
	public TbDept(String DId, TbDept tbDept, String DName, String DLogoUrl,
			String DAddress, String DLati, String DLng, Integer DIf, String a,
			String b, String c, String GId, String GDesc, String GCode,
			String GAdmin, Set<TbDept> tbDepts, Set<TbContact> tbContacts) {
		this.DId = DId;
		this.tbDept = tbDept;
		this.DName = DName;
		this.DLogoUrl = DLogoUrl;
		this.DAddress = DAddress;
		this.DLati = DLati;
		this.DLng = DLng;
		this.DIf = DIf;
		this.a = a;
		this.b = b;
		this.c = c;
		this.GId = GId;
		this.GDesc = GDesc;
		this.GCode = GCode;
		this.GAdmin = GAdmin;
		this.tbDepts = tbDepts;
		this.tbContacts = tbContacts;
	}

	// Property accessors
	@Id
	@Column(name = "D_ID", unique = true, nullable = false, length = 12)
	public String getDId() {
		return this.DId;
	}

	public void setDId(String DId) {
		this.DId = DId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "D_FID")
	public TbDept getTbDept() {
		return this.tbDept;
	}

	public void setTbDept(TbDept tbDept) {
		this.tbDept = tbDept;
	}

	@Column(name = "D_NAME", length = 50)
	public String getDName() {
		return this.DName;
	}

	public void setDName(String DName) {
		this.DName = DName;
	}

	@Column(name = "D_LOGO_URL", length = 100)
	public String getDLogoUrl() {
		return this.DLogoUrl;
	}

	public void setDLogoUrl(String DLogoUrl) {
		this.DLogoUrl = DLogoUrl;
	}

	@Column(name = "D_ADDRESS", length = 100)
	public String getDAddress() {
		return this.DAddress;
	}

	public void setDAddress(String DAddress) {
		this.DAddress = DAddress;
	}

	@Column(name = "D_LATI", length = 20)
	public String getDLati() {
		return this.DLati;
	}

	public void setDLati(String DLati) {
		this.DLati = DLati;
	}

	@Column(name = "D_LNG", length = 20)
	public String getDLng() {
		return this.DLng;
	}

	public void setDLng(String DLng) {
		this.DLng = DLng;
	}

	@Column(name = "D_IF")
	public Integer getDIf() {
		return this.DIf;
	}

	public void setDIf(Integer DIf) {
		this.DIf = DIf;
	}

	@Column(name = "A", length = 60)
	public String getA() {
		return this.a;
	}

	public void setA(String a) {
		this.a = a;
	}

	@Column(name = "B", length = 60)
	public String getB() {
		return this.b;
	}

	public void setB(String b) {
		this.b = b;
	}

	@Column(name = "C", length = 60)
	public String getC() {
		return this.c;
	}

	public void setC(String c) {
		this.c = c;
	}

	@Column(name = "G_ID", length = 50)
	public String getGId() {
		return this.GId;
	}

	public void setGId(String GId) {
		this.GId = GId;
	}

	@Column(name = "G_DESC", length = 500)
	public String getGDesc() {
		return this.GDesc;
	}

	public void setGDesc(String GDesc) {
		this.GDesc = GDesc;
	}

	@Column(name = "G_CODE", length = 50)
	public String getGCode() {
		return this.GCode;
	}

	public void setGCode(String GCode) {
		this.GCode = GCode;
	}

	@Column(name = "G_ADMIN", length = 300)
	public String getGAdmin() {
		return this.GAdmin;
	}

	public void setGAdmin(String GAdmin) {
		this.GAdmin = GAdmin;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "tbDept")
	public Set<TbDept> getTbDepts() {
		return this.tbDepts;
	}

	public void setTbDepts(Set<TbDept> tbDepts) {
		this.tbDepts = tbDepts;
	}

	@ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
	@JoinTable(name = "TB_DEPT_AND_CONTACT", schema = "dbo", catalog = "AGDB", joinColumns = { @JoinColumn(name = "D_ID", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "C_ID", nullable = false, updatable = false) })
	public Set<TbContact> getTbContacts() {
		return this.tbContacts;
	}

	public void setTbContacts(Set<TbContact> tbContacts) {
		this.tbContacts = tbContacts;
	}

}